import AxiosApi from "@/api/AxiosApi"
import type { IPeople } from "@/interface/IPeople";
// 列表数据的请求
export async function getPeopleList(page:number,size:number){
    const result = await AxiosApi.get('/user/list',{params:{page,size}});
    return result.data
}
// 删除选中用户
export async function deleteTableUser(id: number) {
    const result = await AxiosApi.delete('/user/' + id)
    return result.data
}

// 点击搜索通过id获取相对应得用户
export async function searchPeople(id: number) {
    const result = await AxiosApi.get('/user/' + id)
    return result.data.data
}
// 点击查看通过id获取用户信息
export async function lookSee(formData: IPeople) {
    const result = await AxiosApi.get('/user' + formData.id)
    return result.data;
}
// 点击编辑
export async function editPeople(formData: IPeople) {
    const result = await AxiosApi.put('/user/' + formData.id, formData)
    return result.data
}
// 点击新增用户
export async function addPeople(formData: IPeople) {
    const result = await AxiosApi.post('/user/create')
    return result.data
}


// 用户登录接口 
export async function login(username: string, password: string) {
    const result = await AxiosApi.post("/user/login", { username, password });
    return result.data;
}